﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Automted_Bank_teller
{
   public class Deposite_Process : DatabaseConnection
    {

        public static float money_after_Deposite; //to keep in it the money after Deposite is done 
        public static float input_money; //money client enter it to withdrawls from total money

        public void SelectCurrentBalance()
        {
            cmd.CommandText = "Select balance From Clients Where client_id='" + global_var.G_Client_ID + "'and pin_code='" + global_var.G_Client_PIN_Code + "'";

        }

        public void GetCurrentBalance()
        {

            SqlDataReader Selector = cmd.ExecuteReader();
            if (Selector.Read())
            {
                global_var.G_Current_Account_balance = float.Parse(Selector.GetValue(0).ToString());
                //money_after_Deposite = global_var.G_Current_Account_balance + input_money;

            }
        }



        public void UpdateAccountBalaceAfterDeposite()
        {
            cmd.CommandText = "Update Clients Set balance ='"+money_after_Deposite+"'Where client_id ='"+global_var.G_Client_ID+"'and pin_code='"+global_var.G_Client_PIN_Code+"'";
        }


        public void ExecuteQuery()
        {
            cmd.ExecuteNonQuery();
        }




    }
}
